package Vue;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import Controleur.LoadSource;

/**
 * Définit la fenêtre de compte rendu des Locations
 * 
 */
public class Locations extends JDialog {
	
	private static final long serialVersionUID = 1L;
	/** Table regroupant les details de chaque location */
	private JTable tableLocation;

	/**
	 * Instancie une fenetre Locations
	 */
	public Locations() {
		setModal(true);
		setResizable(false);
		setMinimumSize(new Dimension(640, 300));
		setLocation(new Point(200, 200));

		JPanel panel = new JPanel();
		getContentPane().add(panel, BorderLayout.CENTER);
		panel.setLayout(null);

		JLabel lblLocations = new JLabel("Locations");
		lblLocations.setFont(new Font("Tahoma", Font.BOLD, 16));
		lblLocations.setBounds(266, 11, 92, 20);
		panel.add(lblLocations);

		tableLocation = new JTable();
		tableLocation.setForeground(Color.BLACK);
		tableLocation.setBackground(new Color(255, 255, 255));

		String[][] obj = LoadSource.getLocations();

		tableLocation.setModel(new DefaultTableModel(obj, new String[] {
				"Nom du client", "Pr\u00E9nom", "Station de d\u00E9part",
				"Station d'arrivée", "Date Location", "Date Remise" }));
		tableLocation.getColumnModel().getColumn(0).setResizable(false);
		tableLocation.setBounds(52, 58, 435, 152);
		tableLocation.setEnabled(false);
		panel.add(tableLocation);
		JScrollPane scrollPane = new JScrollPane(tableLocation);
		scrollPane.setBounds(10, 42, 614, 219);
		panel.add(scrollPane);

	}
	/**
	 * Méthode fermant la fenêtre
	 */
	public void close() {
		this.dispose();
	}
}
